<?php
namespace BaseExt;
use Symfony\Component\HttpFoundation\Request;

/**
 * PicUpload Class
 */
class MyCurl {

    private  $a = 0;

    function post($url,$post_data){
//        $url = "http://localhost/web_services.php";
//        $post_data = array ("username" => "bob","key" => "12345");

        $ch = curl_init();

        curl_setopt($ch, CURLOPT_URL, $url);
        curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
        // post数据
        curl_setopt($ch, CURLOPT_POST, 1);
        // post的变量
        curl_setopt($ch, CURLOPT_POSTFIELDS, $post_data);

        $output = curl_exec($ch);
        curl_close($ch);

        //打印获得的数据
//        echo "=============WeChat=======";
//        print_r($url);
//        print_r($output);
        return $output;
    }
}
